//
//  MassActivityController.m
//  毕业设计
//
//  Created by 龙波 on 2017/9/22.
//  Copyright © 2017年 ----龙波. All rights reserved.
//

#import "MassActivityController.h"
#import "Carousel.h"
#import "MassTableViewCell.h"
#import "MassAcidityTextController.h"

#define kmasstabeleCell @"masstableCellID"
@interface MassActivityController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation MassActivityController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpFlowView];
    [self setUpTabelView];
    self.navigationItem.title = @"社团活动";
    // Do any additional setup after loading the view.
}

//设置轮播器
-(void)setUpFlowView{
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    Carousel *carousel = [[Carousel alloc]init];
    //设置轮播器位置和尺寸
    carousel.frame = CGRectMake(0, 0,SCREENWIDTH, 100);
    //设置轮播间隔时间(如果不设置，则默认为2秒)
    carousel.timeInterval = 2.0;
    //图片
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"carousel" ofType:@"plist"];
    NSMutableArray *array = [[NSMutableArray alloc]initWithContentsOfFile:plistPath];
    carousel.imageArray = array;
    
    [self.view addSubview:carousel];
    
}

- (void)setUpTabelView
{
        UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 110, SCREENWIDTH, SCREENHEIGHT)];
        tableView.delegate = self;
        tableView.dataSource = self;
    [tableView registerClass:[MassTableViewCell class] forCellReuseIdentifier: kmasstabeleCell];
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

        [self.view addSubview:tableView];
        
        
        
    

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 150;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MassTableViewCell *cell = [MassTableViewCell cellWithTabelView:tableView];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    MassAcidityTextController *acivity = [[MassAcidityTextController alloc]init];
    [self.navigationController pushViewController:acivity animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
